function animateCSS (element, animation, prefix = 'animate__') {
  return new Promise((resolve, reject) => {
    const animationName = `${prefix}${animation}`
    const node = element
    node.classList.add(`${prefix}animated`, animationName)
    // When the animation ends, we clean the classes and resolve the Promise
    function handleAnimationEnd () {
      node.classList.remove(`${prefix}animated`, animationName)
      node.removeEventListener('animationend', handleAnimationEnd)
      resolve('Animation ended')
    }
    node.addEventListener('animationend', handleAnimationEnd)
  })
}
export {
  animateCSS
}
